#ifndef SCHEDULEWIDGET_H
#define SCHEDULEWIDGET_H

#include <QWidget>
#include <QTableWidget>
#include <QComboBox>
#include <QLabel>
#include <QPushButton>
#include <QMap>

namespace Ui {
class ScheduleWidget;
}

class ScheduleWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ScheduleWidget(QWidget *parent = nullptr);
    ~ScheduleWidget();

private:
    void setupUI();
    void setupTable();
    void loadSchedule();

    void addCourse();
    void handleItemChanged(QTableWidgetItem *item);
    void deleteCourse();
    void showPreviousWeek();
    void showNextWeek();

    QPair<QDate,QDate> getWeekRange(int year,int week);

    QTableWidget *tableWidget;
    QComboBox *yearComboBox;
    QComboBox *weekComboBox;
    QLabel *dateRangerLabel;//显示日期范围的标签
    QPushButton *addButton;
    QPushButton *deleteButton;
    QPushButton *prevWeekBtn;
    QPushButton *nextWeekBtn;
    //课程数据存储结构：键为(year,week),值为课程表数据
    QMap<QPair<int,int>,QVector<QVector<QString>>> scheduleData;
    QStringList times;//上午1，上午2...

private:
    Ui::ScheduleWidget *ui;
};

#endif // SCHEDULEWIDGET_H
